Skip to content

fix: preserve streamed output guardrail tripwires in the run loop#2758

Merged
seratch merged 1 commit into
mainfrom
fix/streaming-output-guardrail-tripwire
Mar 23, 2026
Merged

fix: preserve streamed output guardrail tripwires in the run loop#2758
seratch merged 1 commit into
mainfrom
fix/streaming-output-guardrail-tripwire

Conversation

@seratch
Copy link
Copy Markdown
Member

@seratch seratch commented Mar 23, 2026

This pull request fixes a streamed output-guardrail regression where Runner.run_streamed() could swallow OutputGuardrailTripwireTriggered until stream_events() was consumed, allowing callers that await run_loop_task directly to observe a completed run with final_output set. It updates the streaming run loop to re-raise output-guardrail tripwires and cancellation, while avoiding the generic agent-span error path so the existing guardrail-specific tracing remains intact.

It also adds a regression test that exercises the non-stream_events() path by awaiting run_loop_task directly and asserting that the tripwire is surfaced immediately and the final output is not finalized. This keeps the fix aligned with the real repro instead of only covering the already-tested event-consumption path.

@github-actions github-actions Bot added bug Something isn't working feature:core labels Mar 23, 2026
@seratch seratch added this to the 0.13.x milestone Mar 23, 2026
@seratch seratch merged commit 58d3ed2 into main Mar 23, 2026
9 checks passed
@seratch seratch deleted the fix/streaming-output-guardrail-tripwire branch March 23, 2026 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working feature:core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant